<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.sun.xml.internal.fastinfoset.Encoder"%>
<%@ taglib prefix="s" uri="/struts-tags"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>北京天山--我的报价</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language="javascript" src="/js/common/jquery-1.4.2.min.js"></script> 	
<link href="/usercenter/css/usercenter.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="/usercenter/js/usercenter.js"></script>
<script language="javascript" src="/js/calendar.js"></script>
<script language="javascript" src="/usercenter/js/tipswindown.js"></script>
<script language="javascript">
var cdr = new Calendar("cdr");
document.write(cdr);
cdr.showMoreDay = true;
function cargoAdd(val)	{
	window.location.href="/usercenter/newQuotationCargo.do?id="+val;
}
function sortPage(val) {
	window.location.href="/usercenter/editQuotation.do?currentPage="+val+"&id="+${squo.quotationid };
}
var i = 0;
function setI() {
	i++;
}	
</script>
</head>
	
<body>
<div class="main">
	<div class="maintable" >
		<form id="form" name="form"  method="post" action="/usercenter/updateQuotation.do">
		<table class="tb" border="1" bordercolor="#e7e7e7" >	
		  	<tr>
			  	<td colspan="2" class="maintitle" >
					<div class="maintitleimg"></div>
					<div class="maintitle_a">编辑报价单</div>
			  	</td>
      	  	</tr>							  		
	    	<tr style="display:none">
		    	<td align="right" class="field" >报价单ID</td>
				<td align="left" class="fieldtext" ><input type="text" id="id" name="id" value="${squo.quotationid }" /></td>
		  	</tr>
	    	<tr>
		    	<td width="20%" align="right" class="field" >报价单号：</td>
				<td width="80%" align="left" class="fieldtext" >${squo.code }</td>
		  	</tr>	  	
	    	<tr>
		    	<td align="right" class="field" >供应商名称：</td>
				<td align="left" class="fieldtext" >${ssup.supplierName }</td>
		  	</tr>	
	    	<tr>
		    	<td align="right" class="field" ><span>报价日期：</span></td>
				<td align="left" class="fieldtext" ><input type="text" id="quotationTime" name="quotationTime" value="<s:date name="squo.quotationTime" format="yyyy-MM-dd" />" onClick="cdr.show(this);" readonly="readonly" /></td>
			</tr> 	
	    	<tr>
		    	<td align="right" class="field" ><span>报价失效日期：</span></td>
				<td align="left" class="fieldtext" ><input type="text" id="endTime" name="endTime" value="<s:date name="squo.endTime" format="yyyy-MM-dd" />" onClick="cdr.show(this);" readonly="readonly" /></td>
			</tr> 
	    	<tr>
		    	<td align="right" class="field" ><span>付款方式：</span></td>
				<td align="left" class="fieldtext" ><input type="text" id="payType" name="payType" value="${squo.payType }" /></td>
			</tr>	
	    	<tr>
		    	<td align="right" class="field" ><span>预付款(%)：</span></td>
				<td align="left" class="fieldtext" ><input type="text" id="imprest" name="imprest" value="${squo.imprest }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="3" /></td>				
		  	</tr>	  	
	    	<tr>
		    	<td align="right" class="field" ><span>月结(天)：</span></td>
				<td align="left" class="fieldtext" ><input type="text" id="settlement" name="settlement" value="${squo.settlement }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="3" /></td>				
		  	</tr>	 	
	    	<tr>
		    	<td align="right" class="field" ><span>币种：</span></td>
				<td align="left" class="fieldtext" >
					<select id="currency" name="currency" >
						<option id="rmb" value="人民币" >人民币</option>
						<option id="my" value="美元" >美元</option>
						<option id="oy" value="欧元" >欧元</option>
						<option id="ry" value="日元" >日元</option>
					</select>
					<script language="javascript">
					$("#currency").val("${squo.currency }");
					</script>
				</td>				
		  	</tr>	 	
	    	<tr>
		    	<td align="right" class="field" ><span>运输方式：</span></td>
				<td align="left" class="fieldradio" >
					<input type="radio" id="ly" name="transportType" value="陆运" checked="checked" />陆运
					<input type="radio" id="ky" name="transportType" value="空运" />空运
					<input type="radio" id="hy" name="transportType" value="海运" />海运
					<input type="radio" id="hhy" name="transportType" value="混合运输" />混合运输
					<script language="javascript">
						var v = "${squo.transportType }";
						if(v == "陆运") $("input#ly").attr("checked","checked");
						if(v == "空运") $("input#ky").attr("checked","checked");
						if(v == "海运") $("input#hy").attr("checked","checked");
						if(v == "混合运输") $("input#hhy").attr("checked","checked");
					</script>
				</td>				
		  	</tr>	 	
	    	<tr>
		    	<td align="right" class="field" ><span>供应周期(万)：</span></td>
				<td align="left" class="fieldtext" ><input type="text" id="supplyCycle" name="supplyCycle" value="${squo.supplyCycle }"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="3" /></td>				
		  	</tr>	 	
	    	<tr>
		    	<td align="right" class="field" ><span>商品规格：</span></td>
				<td align="left" class="fieldtext" ><textarea id="cargoStandard" name="cargoStandard" cols="35" rows="4" >${squo.cargoStandard }</textarea></td>
			</tr>	 	
	    	<tr>
		    	<td align="right" class="field" ><span>税率(%)：</span></td>
				<td align="left" class="fieldtext" ><input type="text" id="taxRate" name="taxRate" value="${squo.taxRate }"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="3" /></td>				
		  	</tr> 		
	    	<tr>
		    	<td align="right" class="field" ><span>是否推送采购部：</span></td>
				<td align="left" class="fieldradio" >
					<input type="radio" id="ts" name="ifPushPurchasing" value="1" />推送
					<input type="radio" id="bts" name="ifPushPurchasing" value="0"  />不推送		    
					<script language="javascript">
						var v = "${squo.ifPushPurchasing }";
						if(v == "1") $("input#ts").attr("checked","checked");
						if(v == "0") $("input#bts").attr("checked","checked");
					</script>
				</td>				
		  	</tr>	 	
	    	<tr>
		    	<td align="right" class="field" ><span>审核状态：</span></td>
				<td align="left" class="fieldtext" ><s:if test="#squo.auditState == 1">审核通过</s:if><s:else >未通过</s:else></td>				
		  	</tr> 	 	
	    	<tr>
		    	<td align="right" class="field" ><span>审核人：</span></td>
				<td align="left" class="fieldtext" >${squo.auditPerson }</td>				
		  	</tr> 	 	
	    	<tr>
		    	<td align="right" class="field" ><span>审核时间：</span></td>
				<td align="left" class="fieldtext" ><s:date name="#squo.auditTime" format="yyyy-MM-dd" /></td>				
		  	</tr> 	
		  	<tr>
		    	<td align="right" class="field" >产品报价：</td>
				<td align="left" class="fieldradio" >
					<table class="tableStyle" id="aaa" width="90%" cellspacing="1" bgcolor="#f0f0f0">
			  			<tr id="fisrtStatus">
						    <th align="center" bgcolor="#f7f7f7">商品名称</th>
						    <th align="center" bgcolor="#f7f7f7">单价</th>
						    <th align="center" bgcolor="#f7f7f7">单位</th>
						    <th align="center" bgcolor="#f7f7f7">起订数量</th>
						    <th align="center" bgcolor="#f7f7f7">操作</th>
					  	</tr>
					  	<s:iterator value="squocargolist" id="squocargoval" status="squostatus">
				 	 	<tr id="tr${squostatus.index }">
						    <td align="center" bgcolor="#ffffff">
						    	<input type="hidden" name="modelbody[${squostatus.index }].quocargoid" value="${squocargoval.quocargoid }"  />
						    	<input class="referName" style="width:100px;" name="modelbody[${squostatus.index }].name" value="${squocargoval.name }" onfocus="return gotoEdit1('选择商品', 1, ${squostatus.index });"/>
						    </td>
						    <td align="center" bgcolor="#ffffff"><input class="referPrice" style="width:150px;" name="modelbody[${squostatus.index }].price" value="${squocargoval.price }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="8"/></td>
						    <td align="center" bgcolor="#ffffff"><input style="width:100px;" name="modelbody[${squostatus.index }].unit" value="${squocargoval.unit }" /></td>
				    		<td align="center" bgcolor="#ffffff"><input class="referLeast" style="width:50px;" name="modelbody[${squostatus.index }].least" value="${squocargoval.least }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="8"/></td>
				    		<td align="center" bgcolor="#ffffff"><a href="#" onclick="return deleteItem(${squostatus.index }, ${squocargoval.quocargoid});">删除</a></td>
			  			</tr>
			    		<script type="text/javascript">
			    			setI();
			    		</script>
			  			</s:iterator>
					</table>
				</td>				
		  	</tr>	
		  	<tr>
			  	<td align="center" colspan="2" class="maintitle" >
			  		<input type="hidden" id="deleteId" name="deleteId" value="" />
			  		<input type="submit" value="提交" onclick="return submitConfirm();" />
			  		<input type="reset"" value="重置" onclick="return resetConfirm();" />
			  		<input type="button" class="insertrow" value="添加一行" />
			  		<input type="button"" value="返回" onclick="back();" />
			  	</td>
      	  	</tr>
        </table>
        </form>
<!--        <table class="tblist" border="1" bordercolor="#e7e7e7" >-->
<!--		    <tr height="30px" >-->
<!--			    <td colspan="7" >-->
<!--			    	<div style="float:left; width:20%;" class="title" >商品名称</div>-->
<!--			    	<div style="float:left; width:10%;" class="title" >报价日期</div>-->
<!--			    	<div style="float:left; width:10%;" class="title" >失效日期</div>-->
<!--			    	<div style="float:left; width:10%;" class="title" >单价</div>-->
<!--			    	<div style="float:left; width:10%;" class="title" >单位</div>-->
<!--			    	<div style="float:left; width:20%;" class="title" >起订量</div>-->
<!--			    	<div style="float:left; width:20%;" class="title" >操作</div>-->
<!--			    </td>-->
<!--		    </tr>		-->
<!--		    <s:iterator value="squocargolist" id="squocargoval" >-->
<!--		  	<tr height="17px" style="line-height:17px;" >-->
<!--			    <td width="20%" align="center" ><a href="/usercenter/editQuotationCargo.do?id=${squocargoval.quocargoid }" >${squocargoval.name }</a></td>-->
<!--			    <td width="10%" align="center" ><s:date name="#squocargoval.quotationTime" format="yyyy-MM-dd"/></td>-->
<!--			    <td width="10%" align="center" ><s:date name="#squocargoval.endTime" format="yyyy-MM-dd"/></td>-->
<!--			    <td width="10%" align="center" >${squocargoval.price }<s:if test="#squocargoval.price != null" >元</s:if></td>-->
<!--			    <td width="10%" align="center" >${squocargoval.unit }</td>-->
<!--			    <td width="20%" align="center" >${squocargoval.least }<s:if test="#squocargoval.least != null" >${squocargoval.unit }</s:if></td>-->
<!--			    <td width="20%" align="center" >-->
<!--			    	<a href="/usercenter/editQuotationCargo.do?id=${squocargoval.quocargoid }" >编辑</a>    -->
<!--			    	<a href="/usercenter/deleteQuotationCargo.do?id=${squocargoval.quocargoid }&oid=${squocargoval.quotationid }" onclick="return deleteConfirm();" >删除</a>-->
<!--			    </td>-->
<!--	 	 	</tr>	-->
<!--	 	 	</s:iterator>  			  -->
<!--		  	<tr height="30px" >-->
<!--			  	<td align="center" colspan="7" >当前第${pages.currentPage }页，共${pages.pageCount }页 ${pages.allNum }条记录 			  	-->
<!--					<s:if test="pages.currentPage > 1" ><a href="#" onclick="sortPage(1);">首页</a></s:if>-->
<!--					 <s:else>首页 </s:else>|-->
<!--					<s:if test="pages.currentPage > 1" ><a href="#"  onclick="sortPage(${pages.currentPage-1});">上一页</a></s:if>-->
<!--					 <s:else>上一页 </s:else>|-->
<!--					<s:if test="pages.currentPage < pages.pageCount" ><a href="#"  onclick="sortPage(${pages.currentPage+1 });">下一页</a> </s:if>-->
<!--					 <s:else>下一页 </s:else>|-->
<!--					<s:if test="pages.currentPage < pages.pageCount" ><a href="#"  onclick="sortPage(${pages.pageCount });">末页</a> </s:if>-->
<!--					 <s:else>末页</s:else>-->
<!--				</td>-->
<!--      	  	</tr>-->
<!--        </table>-->
	</div>
</div>
<script type="text/javascript">	
function deleteItem(index, id) {
	if(confirm("请问您确定删除么?")) {
		$("#tr"+index).remove();
		var c = $("#deleteId").val();
		if(id >= 0)
			if(c == "")
				$("#deleteId").val(id);
			else
				$("#deleteId").val(c + "," + id);
	}
	return false;
}
$().ready(function() {
		 $(".insertrow").click(function() {			
		 if (i<20){
			var val="<tr id='tr"+i+"'>";
			val+="<td align=\"center\" bgcolor=\"#ffffff\"><input class=\"referName\" style='width:100px;' name='modelbody["+i+"].name' value='' onfocus=\"return gotoEdit1('选择商品', 1, "+i+");\"/></td>";
			val+="<td align=\"center\" bgcolor=\"#ffffff\"><input class=\"referPrice\" style='width:150px;' name='modelbody["+i+"].price' value=''  onkeyup=\"this.value=this.value.replace(/\D/g,'')\" onafterpaste=\"this.value=this.value.replace(/\D/g,'')\" maxlength=\"8\"/></td>";
			val+="<td align=\"center\" bgcolor=\"#ffffff\"><input style='width:100px;' name='modelbody["+i+"].unit' value=''  /></td>";
			val+="<td align=\"center\" bgcolor=\"#ffffff\"><input class=\"referLeast\" style='width:50px;' name='modelbody["+i+"].least' value=''  onkeyup=\"this.value=this.value.replace(/\D/g,'')\" onafterpaste=\"this.value=this.value.replace(/\D/g,'')\" maxlength=\"8\"/></td>";
			val+="<td align=\"center\" bgcolor=\"#ffffff\"><a href=\"#\" onclick=\"return deleteItem("+i+", -1);\">删除</a></td>";
			val+="</tr>";
			$("table.tableStyle").append(val);
			i++;
			}
		 });
	 }); 
</script>
</body>
</html>